﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GalaSoft.MvvmLight;
using TriviaViewModel.ServiceReference1;

namespace TriviaViewModel
{
    public class TopicAndDifficulltyChoiceViewModel:ViewModelBase
    {
        /// <summary>
        /// binding the list of topics in the combo box
        /// </summary>
        private List<string> _topics;
        public List<string> Topics
        {
            get { return _topics; }
            set
            {
                if (_topics != value)
                {
                    _topics = value;
                    RaisePropertyChanged("Topics");
                }
            }
        }
        /// <summary>
        ///  property that binds to the selected type of the combobox of type of questions
        /// </summary>
        private string _selectedTopic;
        public string SelectedTopic
        {
            get { return _selectedTopic; }
            set
            {
                if (_selectedTopic != value)
                {
                    _selectedTopic = value;
                    RaisePropertyChanged("SelectedTopic");
                }
            }
        }
        /// <summary>
        ///  property that binds to the selected difficulty of the combobox of type of questions
        /// </summary>
        private string _selectedDifficulty;
        public string SelectedDifficulty
        {
            get { return _selectedDifficulty; }
            set
            {
                if (_selectedDifficulty != value)
                {
                    _selectedDifficulty = value;
                    RaisePropertyChanged("SelectedDifficulty");
                }
            }
        }

        /// <summary>
        /// binding the list of difficulties in the combo box
        /// </summary>
        private List<string> _difficulties;
        public List<string> Difficulties
        {
            get { return _difficulties; }
            set
            {
                if (_difficulties != value)
                {
                    _difficulties = value;
                    RaisePropertyChanged("Difficulties");
                }
            }
        
        }

        public TopicAndDifficulltyChoiceViewModel()
        {

            using (var proxy = new GameServiceClient())
            {
                Topics = proxy.GetTopics().ToList();
                Difficulties = proxy.GetDificulties().ToList();
            }
        }

    }
}
